package org.xi.maple.api

import org.apache.spark.sql.SparkSession

import scala.collection.mutable

trait MaplePlugin[T] {
  protected var config: T = _

  def getConfig: T = config

  def setConfig(config: T): Unit = {
    this.config = config
  }

  def checkPluginConfig: (Boolean, String) = {
    if (config == null) {
      (false, "Config cannot be null")
    } else {
      checkConfig
    }
  }

  def checkConfig: (Boolean, String) = {
    (true, "")
  }

  def prepare(spark: SparkSession, argsMap: mutable.Map[String, String]): Unit = {
  }
}